home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
tex
/
texsrc.arc
/
TEX7.C
< prev
next >
Wrap
C/C++ Source or Header
|
1988-09-14
|
54KB
|
2,043 lines
overlay "tex7"
#define EXTERN extern
#include "texd.h"
halfword zvsplit ( n , h )
eightbits n ;
scaled h ;
{/* 10 30 */ register halfword Result; r_vsplit
halfword v ;
halfword p ;
halfword q ;
v = eqtb [ 4322 + n ] .hh .v.RH ;
if ( curmark [ 3 ] != 0 )
{
deletetokenr ( curmark [ 3 ] ) ;
curmark [ 3 ] = 0 ;
deletetokenr ( curmark [ 4 ] ) ;
curmark [ 4 ] = 0 ;
}
if ( v == 0 )
{
Result = 0 ;
return(Result) ;
}
if ( mem [(long) v ] .hh.b0 != 1 )
{
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 206 ) ;
}
printesc ( 813 ) ;
print ( 814 ) ;
printesc ( 815 ) ;
{
helpptr = 2 ;
helpline [ 1 ] = 816 ;
helpline [ 0 ] = 817 ;
}
error () ;
Result = 0 ;
return(Result) ;
}
q = vertbreak ( mem [(long) v + 5 ] .hh .v.RH , h , eqtb [ 5707 ] .cint ) ;
p = mem [(long) v + 5 ] .hh .v.RH ;
if ( p == q )
mem [(long) v + 5 ] .hh .v.RH = 0 ;
else while ( true ) {
if ( mem [(long) p ] .hh.b0 == 4 )
if ( curmark [ 3 ] == 0 )
{
curmark [ 3 ] = mem [(long) p + 1 ] .cint ;
curmark [ 4 ] = curmark [ 3 ] ;
mem [(long) curmark [ 3 ] ] .hh .v.LH = mem [(long) curmark [ 3 ] ] .hh .v.LH + 2 ;
}
else {
deletetokenr ( curmark [ 4 ] ) ;
curmark [ 4 ] = mem [(long) p + 1 ] .cint ;
incr ( mem [(long) curmark [ 4 ] ] .hh .v.LH ) ;
}
if ( mem [(long) p ] .hh .v.RH == q )
{
mem [(long) p ] .hh .v.RH = 0 ;
goto lab30 ;
}
p = mem [(long) p ] .hh .v.RH ;
}
lab30: ;
q = prunepagetop ( q ) ;
p = mem [(long) v + 5 ] .hh .v.RH ;
freenode ( v , 7 ) ;
if ( q == 0 )
eqtb [ 4322 + n ] .hh .v.RH = 0 ;
else eqtb [ 4322 + n ] .hh .v.RH = vpackage ( q , 0 , 1 , 1073741823 ) ;
Result = vpackage ( p , h , 0 , eqtb [ 5707 ] .cint ) ;
return(Result) ;
}
printtotals () { r_printtotals
printscaled ( pagesofar [ 1 ] ) ;
if ( pagesofar [ 2 ] != 0 )
{
print ( 181 ) ;
printscaled ( pagesofar [ 2 ] ) ;
print ( 206 ) ;
}
if ( pagesofar [ 3 ] != 0 )
{
print ( 181 ) ;
printscaled ( pagesofar [ 3 ] ) ;
print ( 180 ) ;
}
if ( pagesofar [ 4 ] != 0 )
{
print ( 181 ) ;
printscaled ( pagesofar [ 4 ] ) ;
print ( 826 ) ;
}
if ( pagesofar [ 5 ] != 0 )
{
print ( 181 ) ;
printscaled ( pagesofar [ 5 ] ) ;
print ( 827 ) ;
}
if ( pagesofar [ 6 ] != 0 )
{
print ( 182 ) ;
printscaled ( pagesofar [ 6 ] ) ;
}
}
zfreezepagesp ( s )
smallnumber s ;
{r_freezepagesp
pagecontents = s ;
pagesofar [ 0 ] = eqtb [ 5705 ] .cint ;
pagemaxdepth = eqtb [ 5706 ] .cint ;
pagesofar [ 7 ] = 0 ;
pagesofar [ 1 ] = 0 ;
pagesofar [ 2 ] = 0 ;
pagesofar [ 3 ] = 0 ;
pagesofar [ 4 ] = 0 ;
pagesofar [ 5 ] = 0 ;
pagesofar [ 6 ] = 0 ;
leastpagecos = 1073741823 ;
#ifdef STAT
if ( eqtb [ 5300 ] .cint > 0 )
{
begindiagnos () ;
printnl ( 835 ) ;
printscaled ( pagesofar [ 0 ] ) ;
print ( 836 ) ;
printscaled ( pagemaxdepth ) ;
enddiagnosti ( false ) ;
}
#endif /* STAT */
}
zboxerror ( n )
eightbits n ;
{r_boxerror
error () ;
begindiagnos () ;
printnl ( 689 ) ;
showbox ( eqtb [ 4322 + n ] .hh .v.RH ) ;
enddiagnosti ( true ) ;
flushnodelis ( eqtb [ 4322 + n ] .hh .v.RH ) ;
eqtb [ 4322 + n ] .hh .v.RH = 0 ;
}
zensurevbox ( n )
eightbits n ;
{r_ensurevbox
halfword p ;
p = eqtb [ 4322 + n ] .hh .v.RH ;
if ( p != 0 )
if ( mem [(long) p ] .hh.b0 == 0 )
{
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 837 ) ;
}
{
helpptr = 3 ;
helpline [ 2 ] = 838 ;
helpline [ 1 ] = 839 ;
helpline [ 0 ] = 840 ;
}
boxerror ( n ) ;
}
}
zfireup ( c )
halfword c ;
{/* 10 */ r_fireup
halfword p, q, r, s ;
halfword prevp ;
quarterword n ;
boolean wait ;
integer savevbadness ;
scaled savevfuzz ;
halfword savesplittop ;
if ( mem [(long) bestpagebrea ] .hh.b0 == 12 )
{
geqworddefin ( 5306 , mem [(long) bestpagebrea + 1 ] .cint ) ;
mem [(long) bestpagebrea + 1 ] .cint = 10000 ;
}
else geqworddefin ( 5306 , 10000 ) ;
if ( curmark [ 2 ] != 0 )
{
if ( curmark [ 0 ] != 0 )
deletetokenr ( curmark [ 0 ] ) ;
curmark [ 0 ] = curmark [ 2 ] ;
incr ( mem [(long) curmark [ 0 ] ] .hh .v.LH ) ;
deletetokenr ( curmark [ 1 ] ) ;
curmark [ 1 ] = 0 ;
}
if ( c == bestpagebrea )
bestpagebrea = 0 ;
if ( eqtb [ 4577 ] .hh .v.RH != 0 )
{
{
if ( interaction == 3 )
wakeuptermin () ;
printnl ( 133 ) ;
print ( 206 ) ;
}
printesc ( 274 ) ;
print ( 851 ) ;
{
helpptr = 2 ;
helpline [ 1 ] = 852 ;
helpline [ 0 ] = 840 ;
}
boxerror ( 255 ) ;
}
insertpenalt = 0 ;
savesplittop = eqtb [ 3536 ] .hh .v.RH ;
r = mem [(long) memtop ] .hh .v.RH ;
while ( r != memtop ) {
if ( mem [(long) r + 2 ] .hh .v.LH != 0 )
{
n = mem [(long) r ] .hh.b1 ;
ensurevbox ( n ) ;
if ( eqtb [ 4322 + n ] .hh .v.RH == 0 )
eqtb [ 4322 + n ] .hh .v.RH = newnullbox () ;
p = eqtb [ 4322 + n ] .hh .v.RH + 5 ;
while ( mem [(long) p ] .hh .v.RH != 0 ) p = mem [(long) p ] .hh .v.RH ;
mem [(long) r + 2 ] .hh .v.RH = p ;
}
r = mem [(long) r ] .hh .v.RH ;
}
q = memtop - 4 ;
mem [(long) q ] .hh .v.RH = 0 ;
prevp = memtop - 2 ;
p = mem [(long) prevp ] .hh .v.RH ;
while ( p != bestpagebrea ) {
if ( mem [(long) p ] .hh.b0 == 3 )
{
r = mem [(long) memtop ] .hh .v.RH ;
while ( mem [(long) r ] .hh.b1 != mem [(long) p ] .hh.b1 ) r = mem [(long) r ] .hh .v.RH ;
if ( mem [(long) r + 2 ] .hh .v.LH == 0 )
wait = true ;
else {
wait = false ;
s = mem [(long) p + 4 ] .hh .v.LH ;
mem [(long) mem [(long) r + 2 ] .hh .v.RH ] .hh .v.RH = s ;
s = mem [(long) r + 2 ] .hh .v.RH ;
if ( mem [(long) r + 2 ] .hh .v.LH == p )
{
if ( mem [(long) r ] .hh.b0 == 1 )
if ( ( mem [(long) r + 1 ] .hh .v.LH == p ) && ( mem [(long) r + 1 ] .hh .v.RH
!= 0 ) )
{
while ( mem [(long) s ] .hh .v.RH != mem [(long) r + 1 ] .hh .v.RH ) s = mem [(long)
s ] .hh .v.RH ;
eqtb [ 3536 ] .hh .v.RH = mem [(long) p + 4 ] .hh .v.RH ;
mem [(long) p + 4 ] .hh .v.LH = prunepagetop ( mem [(long) r + 1 ] .hh .v.RH )
;
if ( mem [(long) p + 4 ] .hh .v.LH != 0 )
{
tempptr = vpackage ( mem [(long) p + 4 ] .hh .v.LH , 0 , 1 ,
1073741823 ) ;
mem [(long) p + 3 ] .cint = mem [(long) tempptr + 3 ] .cint + mem [(long) tempptr
+ 2 ] .cint ;
freenode ( tempptr , 7 ) ;
wait = true ;
}
mem [(long) s ] .hh .v.RH = 0 ;
}
mem [(long) r + 2 ] .hh .v.LH = 0 ;
n = mem [(long) r ] .hh.b1 ;
tempptr = mem [(long) eqtb [ 4322 + n ] .hh .v.RH + 5 ] .hh .v.RH ;
freenode ( eqtb [ 4322 + n ] .hh .v.RH , 7 ) ;
eqtb [ 4322 + n ] .hh .v.RH = vpackage ( tempptr , 0 , 1 ,
1073741823 ) ;
}
else {
while ( mem [(long) s ] .hh .v.RH != 0 ) s = mem [(long) s ] .hh .v.RH ;
mem [(long) r + 2 ] .hh .v.RH = s ;
}
}
mem [(long) prevp ] .hh .v.RH = mem [(long) p ] .hh .v.RH ;
mem [(long) p ] .hh .v.RH = 0 ;
if ( wait )
{
mem [(long) q ] .hh .v.RH = p ;
q = p ;
incr ( insertpenalt ) ;
}
else {
deletegluere ( mem [(long) p + 4 ] .hh .v.RH ) ;
freenode ( p , 5 ) ;
}
p = prevp ;
}
else if ( mem [(long) p ] .hh.b0 == 4 )
{
if ( curmark [ 1 ] == 0 )
{
curmark [ 1 ] = mem [(long) p + 1 ] .cint ;
incr ( mem [(long) curmark [ 1 ] ] .hh